package com.googlecode.droidcare.common.impl.provider;

import org.mozilla.javascript.Function;

import com.googlecode.droidcare.common.AppContext;
import com.googlecode.droidcare.common.ScriptEngine;
import com.googlecode.droidcare.common.api.provider.ProviderService;
import com.googlecode.droidcare.common.provider.Provider;

public class ProviderServiceJs implements ProviderService {
	
	private Function updateFunc;
	private Function initFunc;

	public void update(Provider provider) {
		ScriptEngine engine = AppContext.getInstance().getScriptEngine();
		engine.callFunction(updateFunc, provider);
	}
	
	public void init(Provider provider) {
		ScriptEngine engine = AppContext.getInstance().getScriptEngine();
		engine.callFunction(initFunc, provider);
	}
	
	public Function getUpdateFunc() {
		return updateFunc;
	}

	public void setUpdateFunc(Function updateFunc) {
		this.updateFunc = updateFunc;
	}

	public Function getInitFunc() {
		return initFunc;
	}

	public void setInitFunc(Function initFunc) {
		this.initFunc = initFunc;
	}

}
